<template>
  <div id="app">
    <transition name="fade" mode="out-in">
      <keep-alive :max="10" include="Home,BaoBao,Ordel,Mine">
          <component :is="coms[currentIndex]" />
      </keep-alive>
    </transition>

   
   <div class="tabber">
    <span :class="{act:currentIndex == index}" @click="fun(index)" v-for="(item,index) in arr2" :key="index"> {{item}} </span>
   </div>

  </div>
</template>

<script>
import Home from './components/Home.vue'
import BaoBao from './components/BaoBao.vue'
import Ordel from './components/Ordel.vue'
import Mine from './components/Mine.vue'

import {shop_list,tuan_list} from 'utils/api'

export default {
  components: {
    Home,
    BaoBao,
    Ordel,
    Mine
  },
  data(){
    return{
      currentIndex:0,
      arr2:["首页","爆爆团","订单","我的"],
      coms:["Home","BaoBao","Ordel","Mine"],
    }
  },
  methods:{
    fun(index){
      this.currentIndex = index;
    }
  },

  mounted(){
      shop_list

  }
}
</script>

<style lang="scss">
*{
  margin: 0;
  padding: 0;
}
.tabber{
  display: flex;
  width: 100%;
  justify-content: space-around;
  padding: 10px 0;
  position: fixed;
  bottom: 0;
  box-sizing: border-box;
  align-content: center;
  border-top: 1px solid #ccc;
}
.tabber .act{
  color: rgb(42, 180, 235);
  font-weight: bold;
}
.fade-enter{ // 动画开始时的状态
  opacity: 0;
}
.fade-enter-active{
  transition: all 0.3s;
}
.fade-enter-to{ // 动画结束时的状态
  opacity: 1;
}

.fade-leave{ // 动画开始时的状态
  opacity: 1;
}
.fade-leave-active{
  transition: all 0.2s;
}
.fade-leave-to{ // 动画结束时的状态
  opacity: 0;
}
</style>
